<template>
  <div class="pt-20">
    <div class="w100 h-60 br-16 bgff rowsb rowsm pl-20 pr-20 mb-16">
        <div class="fs-16 col333">旧密码</div>
        <el-input v-model="oldPwd" placeholder="请输入旧密码" class="w-400 input" show-password></el-input>
    </div>

    <div class="w100 h-60 br-16 bgff rowsb rowsm pl-20 pr-20 mb-16">
        <div class="fs-16 col333">新密码</div>
        <el-input v-model="newPwd" placeholder="请输入新密码" class="w-400 input" show-password></el-input>
    </div>

    <div class="w100 h-60 br-16 bgff rowsb rowsm pl-20 pr-20 mb-100">
        <div class="fs-16 col333">确认密码</div>
        <el-input v-model="newPwd2" placeholder="请确认密码" class="w-400 input" show-password></el-input>
    </div>

    <div class="w100 rowsc rowsm">
        <div class="w-500 h-50 br-25 rowsc rowsm colfff fs-20 fw-b" style="background-color: #E33636;" @click="changePwd">确定</div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      oldPwd:'',
      newPwd:'',
      newPwd2:''
    };
  },
  watch: {},
  computed: {},
  methods: {
    changePwd(){
      if(!this.oldPwd) return this.$notify({title: '提示',message: '请输入密码'});
      if(!this.newPwd) return this.$notify({title: '提示',message: '请输入密码'});
      if(this.newPwd != this.newPwd2) return this.$notify({title: '提示',message: '两次密码不一致'});
      
      let data = {
        password:this.oldPwd,
        passwordNew:this.newPwd
        }
      this.$axios.post('prouser/updatePassword',{...data}).then(res => {
        this.$notify({
          title: '提示',
          message: res.data.msg
        });
        if(res.data.code != 200) return 
        // setTimeout(() => {
        //   this.$emit('changeActive',0)
        // }, 1000);
        sessionStorage.removeItem('token');
        this.$router.push("/login");
      })
    }
  },
  created() {},
  mounted() {}
};
</script>
<style lang="scss" scoped>
  .input /deep/ .el-input__inner  {
    border: none;
    background-color: rgba(0, 0, 0, 0);
    font-size: 14px;
    text-align: right;
  }
</style>